package com.sc.VenusQueryBeta.model.account.daishu;

import com.hengjun.kingstar.sdk.base.BaseModel;
import com.hengjun.kingstar.sdk.helper.RetrofitCreateHelper;
import com.hengjun.kingstar.sdk.helper.RxHelper;
import com.sc.VenusQueryBeta.api.Host;
import com.sc.VenusQueryBeta.api.account.AccountApi;
import com.sc.VenusQueryBeta.contract.account.daishu.DaiShuContract;
import com.sc.VenusQueryBeta.model.bean.account.CurrencyListBean;
import com.sc.VenusQueryBeta.model.bean.account.DaiShuBean;

import io.reactivex.Observable;


/**
 * Created by SC-02 on 2018/9/19.
 * 贷赎明细model 继承Basemodel 并且实现契约累的model方法
 */

public class DaiShuModel extends BaseModel implements DaiShuContract.IDaiShuModel {

    /**
     * 实例化对象
     */
    public static DaiShuModel newInstance(){
        return new DaiShuModel();
    }

    @Override
    public Observable<CurrencyListBean> queryAllCurrencyList(String serverAddress, String projectName, int serverPort) {
        return RetrofitCreateHelper.createApi(AccountApi.class, Host.base + serverAddress + ":" + serverPort + "/" + projectName + "/").queryCurrencyList().compose(RxHelper.<CurrencyListBean>rxSchedulerHelper());
    }

    @Override
    public Observable<DaiShuBean> daishu(int clientindex, String serverAddress, String projectName, int serverPort,String currencynameCN) {
        return RetrofitCreateHelper.createApi(AccountApi.class, Host.base+serverAddress+":"+serverPort+"/"+projectName+"/").
                daishu(clientindex, currencynameCN).compose(RxHelper.<DaiShuBean>rxSchedulerHelper());
    }
}
